import eventBus from '../utils/eventBus';
import { goto } from '../utils/globalFuncs';

interface LinkProps {
    to: string
    className?: string
    children?: any
}

export const Link = (props: LinkProps) => {
    return (
        <a className={props.className} href='javascript::' onClick={() => {
            var to: string = props.to;
            if (to == '/subscribe') {
                eventBus.emit('changeWhiteHeaderBg', true);
            } else {
                eventBus.emit('changeWhiteHeaderBg', false);

            }
            goto(props.to);
        }} >
            {props.children}
        </a>
    )
}